package cn.iocoder.yudao.module.train.dal.mysql.venue;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.train.dal.dataobject.venue.VenueDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.train.controller.admin.venue.vo.*;

/**
 * 场地 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface VenueMapper extends BaseMapperX<VenueDO> {

    default PageResult<VenueDO> selectPage(VenuePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VenueDO>()
                .eqIfPresent(VenueDO::getVenueNo, reqVO.getVenueNo())
                .eqIfPresent(VenueDO::getCapacity, reqVO.getCapacity())
                .eqIfPresent(VenueDO::getArea, reqVO.getArea())
                .eqIfPresent(VenueDO::getVenueType, reqVO.getVenueType())
                .betweenIfPresent(VenueDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VenueDO::getId));
    }

    default List<VenueDO> selectList(VenuePageReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<VenueDO>()
                .eqIfPresent(VenueDO::getVenueNo, reqVO.getVenueNo())
                .eqIfPresent(VenueDO::getCapacity, reqVO.getCapacity())
                .eqIfPresent(VenueDO::getArea, reqVO.getArea())
                .eqIfPresent(VenueDO::getVenueType, reqVO.getVenueType())
                .betweenIfPresent(VenueDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(VenueDO::getId));
    }
}
